package com.it.bannner.video;

import android.annotation.SuppressLint;
import android.content.Context;

import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.cache.CacheDataSource;

import chuangyuan.ycj.videolibrary.factory.DefaultCacheDataSourceFactory;
import chuangyuan.ycj.videolibrary.listener.DataSourceListener;

public class OfficeDataSource implements DataSourceListener {
    public static final String TAG = "OfficeDataSource";
    private CacheDataSource.EventListener eventListener;
    private Context context;

    public OfficeDataSource(Context context, CacheDataSource.EventListener eventListener) {
        this.context = context;
        this.eventListener = eventListener;
    }

    @SuppressLint("WrongConstant")
    @Override
    public DataSource.Factory getDataSourceFactory() {
        int cacheSize = 300 * 1024 * 1024;
        //采用默认
        return new DefaultCacheDataSourceFactory(context, cacheSize, "1234567887654321".getBytes(), eventListener);

    }
}